
using Qdb;
using Qdb.Internal;
using Qdb.Drs.Qdb;

namespace Qdb.Drs.Qdb
{
	/// <exclude></exclude>
	public class QdbProviderFactory
	{
		public static IQdbReplicationProvider NewInstance(IObjectContainer oc, string name
			)
		{
			if (IsClient(oc))
			{
				return new ClientServerReplicationProvider(oc, name);
			}
			else
			{
				return new FileReplicationProvider(oc, name);
			}
		}

		public static IQdbReplicationProvider NewInstance(IObjectContainer oc)
		{
			return NewInstance(oc, null);
		}

		private static bool IsClient(IObjectContainer oc)
		{
			return ((IInternalObjectContainer)oc).IsClient;
		}
	}
}
